<template>
  <div class="navbar">
    <van-nav-bar :title="cakename" @click-left="handleback">
      <template #right>
        <van-icon name="cart" size="18" @click="handleCartAdd" />
      </template>
      <template #left>
        <van-icon name="arrow-left" size="18" />
      </template>
    </van-nav-bar>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
let router = useRouter();
let props = defineProps({
  cakename: {
    type: String,
    required: true,
    default: "蛋糕",
  },
});
let handleback = () => history.back();
let handleCartAdd = () => {
  router.push("/cart");
};
</script>

<style lang="less" scoped>
:deep(.van-nav-bar .van-icon),
:deep(.van-nav-bar__title) {
  color: #a36663;
}
</style>
